<?php
header("Content-type:application/json");
$dir = 'uploads/';
$files = array_diff(scandir($dir), array('.', '..'));
$file_list = array();
foreach ($files as $file) {
    $file_path = $dir . $file;
    $file_info = array(
        'name' => $file,
        'size' => filesize($file_path),
        'type' => mime_content_type($file_path),
        'date' => date('Y-m-d H:i:s', filemtime($file_path))
    );
    array_push($file_list, $file_info);
}
echo json_encode($file_list);